/**  
 * All rights Reserved, Designed By <a href="www.itttq.com" target="_blank">www.itttq.com</a>
 * @date:   2017-07-21 11:42:21
 * @Copyright: 2017 <a href="www.itttq.com" target="_blank">www.itttq.com</a> Inc. All rights reserved. 
 */
package com.itttq.gshop.pbpm.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.itttq.gshop.domain.po.WareBrandPo;
import com.itttq.gshop.domain.to.ResultPageTo;
import com.itttq.gshop.pbpm.mapper.IWareBrandMapper;

@Service
public class WareBrandService {
	@Autowired
	private IWareBrandMapper wareBrandMapper;
	
	/**
	 * 根据ID获取WareBrandPo对象
	 * 
	 * @param id
	 * @return
	 * @Author 迷蝶
	 * @return WareBrandPo
	 */
	public WareBrandPo getWareBrand(int id) {
		return wareBrandMapper.findWareBrandById(id);
	}
	
	/**
	 * 根据条件获取WareBrandPo对象，并返回查询的数据总数
	 * 
	 * @param wareBrand
	 * @Author 迷蝶
	 * @return ResultPageTo<WareBrandPo>
	 */
	public ResultPageTo<WareBrandPo> getWareBrands(WareBrandPo wareBrand) {
		return new ResultPageTo<WareBrandPo>(wareBrand.getStart(), wareBrand.getSize(), 
				wareBrandMapper.findWareBrandCount(wareBrand), wareBrandMapper.findWareBrands(wareBrand));
	}
	
	/**
	 * 根据ID删除WareBrandPo对象
	 * 
	 * @param id
	 * @Author 迷蝶
	 */
	public Integer delWareBrand(int id) {
		return wareBrandMapper.delWareBrandById(id);
	}
	
	/**
	 * 增加WareBrandPo对象
	 * 
	 * @param wareBrand
	 * @Author 迷蝶
	 */
	public Integer addWareBrand(WareBrandPo wareBrand) {
		return wareBrandMapper.addWareBrand(wareBrand);
	}
	
	/**
	 * 根据条件更新WareBrandPo对象
	 * 
	 * @param wareBrand
	 * @Author 迷蝶
	 */
	public Integer updateWareBrand(WareBrandPo wareBrand) {
		return wareBrandMapper.updateWareBrand(wareBrand);
	}
	
}
